/* eslint valid-jsdoc: "off" */

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_rongqi2025';

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  	// cors配置
	config.cors = {
		origin: '*',
		allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
	}
  	// CSRF安全配置
	config.security = {
		csrf: {
			enable: false
		}
	}
  //上传配置 是有那个multipart的插件
  	//上传配置
	config.multipart = {
		mode: 'file',
		fileSize: '50mb',
		fileExtensions: ['.jpg', '.jpeg', '.png', '.gif', '.bmp'],
		tmpdir: 'tmp',  //文件会先存到临时目录
		cleanSchedule: {
			cron: '0 0 0 * * *',  // 每天0点执行清理
		}
	}

	config.jwt = {
		secret: 'rongqi2025',
		enable: true,
		// 过期时间
		expiresIn: '7d', 


		// 白名单
		ignore : [
			'/login'
		],
		metaField: 'jwtMeta'//避免默认 meta冲突
	}

  return {
    ...config,
    ...userConfig,
  };
};
